#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
const int MAXN = 200010;

int W[MAXN],L[MAXN],dp[MAXN];

int main()
{
    int n,i;
    while(~scanf("%d",&n))
    {
        dp[0] = 0;
        for(i = 1; i <= n; ++i)
        {

			scanf("%d %d",&W[i],&L[i]);
			W[i+n] = W[i];
            L[i+n] = L[i];
			dp[i] = dp[n+i] = 0;
		}
		int cost = 0, Max = 0;
        for(i = 1; i <= 2*n; ++i)
        {
            if(cost + W[i] >= L[i])
            {
                dp[i] = dp[i-1] + 1;
                cost = cost + W[i] - L[i];
            }
			else
				cost = 0;
			if(dp[i] > Max)
                Max = dp[i];
            if(dp[i] == n)
                break;
        }

        printf("%d\n",Max);
    }

    return 0;
}
